public class test {
    public static void main(String[] args) {
        int a=3;
        switch (a){
            case 1:
                System.out.println(1);
                break;
            case 2:
                System.out.println(2);
                break;
            case 3:
                System.out.println(3);
                break;
            default:
                System.out.println("匹配失败");
        }
    }
    //如果case结束没有break中断，那么数值匹配到哪个case，就从哪个case开始执行后面所有语句
    //直到遇到break或者执行到default结束
    public static void main1(String[] args) {
        int a=3;
        switch (a){
            case 1:
                System.out.println(1);
            case 2:
                System.out.println(2);
            case 3:
                System.out.println(3);
            default:
                System.out.println("匹配失败");
        }
    }
}
